'use strict';

var webpack = require('webpack');

module.exports = {
  externals: {
    'lightbi-treebeard': 'window.__LIB["lightbi-treebeard"]',
    'lightbi-image-upload': 'window.__LIB["lightbi-image-upload"]',
    'lightbi-front-utils': 'window.__LIB["lightbi-front-utils"]',
    'lightbi-front-widget': 'window.__LIB["lightbi-front-widget"]',
    'lightbi-front-page-group': 'window.__LIB["lightbi-front-page-group"]',
    'lightbi-docs': 'window.__LIB["lightbi-docs"]',
    'radium': 'window.__LIB["radium"]',
    'react': 'window.__LIB["react"]'
  },
  output: {
    path : __dirname + '/min',
    publicPath : __dirname + '/min',
    filename : '[name].js',
  },
  debug: false,
  entry: {
    entrance : './src/entrance.js',
  },
  stats: {
    colors: true,
    reasons: true
  },
  plugins: [
    new webpack.optimize.DedupePlugin(),
    new webpack.optimize.UglifyJsPlugin(),
    new webpack.optimize.OccurenceOrderPlugin(),
    new webpack.optimize.AggressiveMergingPlugin(),
    new webpack.DefinePlugin({
      "process.env": {
        NODE_ENV: JSON.stringify("production")
      }
    })
  ],
  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loaders: ['babel?' + JSON.stringify({presets: ['react', 'es2015', 'stage-0'], plugins: ['transform-decorators-legacy']})]
      },
      {
        test: /\.css$/,
        loader: "style!css"
      }
    ]
  }
};
